<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"github.com","root":"/","scheme":"Gemini","version":"7.7.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="shell常用快捷键,增强记忆方便操作">
<meta property="og:type" content="article">
<meta property="og:title" content="shell常用快捷键">
<meta property="og:url" content="https://github.com/13850554413/13850554413.github.io/2013/12/02/shell%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE/index.html">
<meta property="og:site_name" content="天上人间">
<meta property="og:description" content="shell常用快捷键,增强记忆方便操作">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2013-12-02T07:30:16.000Z">
<meta property="article:modified_time" content="2020-02-18T11:26:16.417Z">
<meta property="article:author" content="小灰灰">
<meta property="article:tag" content="linux">
<meta property="article:tag" content="笔记">
<meta property="article:tag" content="shell">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://github.com/13850554413/13850554413.github.io/2013/12/02/shell%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true
  };
</script>

  <title>shell常用快捷键 | 天上人间</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">天上人间</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">个人博客| 学习交流| 日志心态</p>
  </div>

  <div class="site-nav-right"></div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://github.com/13850554413/13850554413.github.io/2013/12/02/shell%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="小灰灰">
      <meta itemprop="description" content="我的博客用于记录">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="天上人间">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          shell常用快捷键
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2013-12-02 15:30:16" itemprop="dateCreated datePublished" datetime="2013-12-02T15:30:16+08:00">2013-12-02</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-02-18 19:26:16" itemprop="dateModified" datetime="2020-02-18T19:26:16+08:00">2020-02-18</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/shell-linux-%E7%AC%94%E8%AE%B0/" itemprop="url" rel="index">
                    <span itemprop="name">shell, linux, 笔记</span>
                  </a>
                </span>
            </span>

          
            <div class="post-description">shell常用快捷键,增强记忆方便操作</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><strong>方向          ＜－前               后 -＞</strong><br><strong>删除</strong><br>ctrl + d     删除光标所在位置上的字符相当于VIM里x或者dl<br>ctrl + h     删除光标所在位置前的字符相当于VIM里hx或者dh<br>ctrl + k     删除光标后面所有字符相当于VIM里d shift+$<br>ctrl + u     删除光标前面所有字符相当于VIM里d shift+^<br>ctrl + w     删除光标前一个单词相当于VIM里db<br>ctrl + y     恢复ctrl+u上次执行时删除的字符<br>ctrl + ?     撤消前一次输入<br>alt  + r     撤消前一次动作<br>alt  + d     删除光标所在位置的后单词  </p>
<p><strong>移动</strong><br>ctrl + a      将光标移动到命令行开头相当于VIM里shift+^<br>ctrl + e      将光标移动到命令行结尾处相当于VIM里shift+$<br>ctrl + f      光标向后移动一个字符相当于VIM里l<br>ctrl + b      光标向前移动一个字符相当于VIM里h<br>ctrl + 方向键左键    光标移动到前一个单词开头<br>ctrl + 方向键右键    光标移动到后一个单词结尾<br>ctrl + x       在上次光标所在字符和当前光标所在字符之间跳转<br>alt  + f      跳到光标所在位置单词尾部  </p>
<p><strong>替换</strong><br>ctrl + t     将光标当前字符与前面一个字符替换<br>alt  + t     交换两个光标当前所处位置单词和光标前一个单词<br>alt  + u     把光标当前位置单词变为大写<br>alt  + l     把光标当前位置单词变为小写<br>alt  + c     把光标当前位置单词头一个字母变为大写<br>^oldstr^newstr    替换前一次命令中字符串  </p>
<p><strong>历史命令编辑</strong><br>ctrl + p    返回上一次输入命令字符<br>ctrl + r    输入单词搜索历史命令<br>alt  + p    输入字符查找与字符相接近的历史命令<br>alt  + &gt;    返回上一次执行命令  </p>
<p><strong>其它</strong><br>ctrl + s      锁住终端<br>ctrl + q      解锁终端<br>ctrl + l      清屏相当于命令clear<br>ctrl + c      另起一行<br>ctrl + i      类似TAB健补全功能<br>ctrl + o      重复执行命令<br>alt  + 数字键  操作的次数  </p>
<p><strong>实际操作:</strong>  </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">-<span class="comment">#c+l  清屏先  </span></span><br><span class="line">minuit@suse:~&gt;str1 str2 str3  </span><br><span class="line"><span class="comment">#输入三个单词发现第一单词需要大写好按c+a跳到开头按a+c</span></span><br><span class="line">minuit@suse:~&gt; Str1 str2 str3</span><br><span class="line"><span class="comment">#好现在单词就变成了现在这个样子,又发现第二个单词要全大写(这样的命令真是玩死人</span></span><br><span class="line"><span class="comment">#:( )好吧如果你当前光标在第二个单词,那直接a+u把这个单词改变,如果不在的话那按住</span></span><br><span class="line"><span class="comment">#c+a接着c+f跳到第二个单词那再a+u就OK了结果像下面所示。</span></span><br><span class="line">minuit@suse:~&gt; Str1 STR2 str3</span><br><span class="line"><span class="comment">#我想换过来怎么办我的位置已经在最后一个单词这个好办按住a+2+b哈哈跳到了第二个单</span></span><br><span class="line"><span class="comment">#词再来一下a+l这下第二个单词全小写了,再来一个比较典型的例子</span></span><br><span class="line"><span class="comment">#[url]http://bbs.chinaunix.netviewthread.php?tid=842595[/url]</span></span><br><span class="line"><span class="comment">#标题:如何将数据文件中的每个词的第一个字母变成大写？</span></span><br><span class="line"><span class="comment">#哈哈这个难不到我们吧因为我们已经会了a+c了</span></span><br><span class="line">minuit@suse:~&gt; welcome to chinaunix!</span><br><span class="line"><span class="comment">#不就是变个大小写吗按住c+a接着a+3+c看看效果</span></span><br><span class="line">minuit@suse:~&gt; Welcome To Chinaunix!</span><br><span class="line"><span class="comment">#GOOD很简单</span></span><br><span class="line">我们再来试试替换</span><br><span class="line">minuit@suse:~&gt; Welcome To Chinaunix!</span><br><span class="line"><span class="comment">#还是这三单词c+a跳到开头再接着跳到第二个单词那(因为a+t只能跟前一个单词做替换所以不能在第一个单词按a+t)按住a+t</span></span><br><span class="line">minuit@suse:~&gt; To Welcome Chinaunix!</span><br><span class="line"><span class="comment">#现在成这样子的了如果我用再按a+2+t那又变了一个样</span></span><br><span class="line">minuit@suse:~&gt; Chinaunix!  Welcome To</span><br><span class="line"><span class="comment">#好了来一点比较常用的</span></span><br><span class="line">minuit@suse:~&gt;ls /tmp/</span><br><span class="line"> <span class="comment">#看看下面有些什么</span></span><br><span class="line">file1 file2 file3 ..... ..</span><br><span class="line">minuit@suse:~&gt;^ls^<span class="built_in">cd</span></span><br><span class="line"> <span class="comment">#现在再又想进入目录很简单的健入替换命令就行了在命令很长时用这个替换可以省掉很多按a+b或a+f的时间</span></span><br><span class="line"><span class="built_in">cd</span> /tmp/</span><br><span class="line">minuit@suse:/tmp&gt;</span><br><span class="line"><span class="comment">#进入了tmp目录了</span></span><br></pre></td></tr></table></figure>
<p>###跳转的命令就不试了大家自己体会试也看不见^_^   ###</p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/linux/" rel="tag"># linux</a>
              <a href="/tags/%E7%AC%94%E8%AE%B0/" rel="tag"># 笔记</a>
              <a href="/tags/shell/" rel="tag"># shell</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2013/12/02/vim%E7%AE%80%E8%AE%B0/" rel="prev" title="vim笔记">
      <i class="fa fa-chevron-left"></i> vim笔记
    </a></div>
      <div class="post-nav-item">
    <a href="/2013/12/02/pacman%E7%AE%80%E8%AE%B0/" rel="next" title="pacman简记">
      pacman简记 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let activeClass = CONFIG.comments.activeClass;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">小灰灰</p>
  <div class="site-description" itemprop="description">我的博客用于记录</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">10</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">10</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/yourname" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;yourname"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://yoursite.com/" title="http:&#x2F;&#x2F;yoursite.com" rel="noopener" target="_blank">链接1</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://yoursite.com/" title="http:&#x2F;&#x2F;yoursite.com" rel="noopener" target="_blank">链接2</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">小灰灰</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.2.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.7.1
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
